package com.yanqu.road.entity.activity.unionChest.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eActivityConfigType;
import com.yanqu.road.utils.string.StringUtils;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class UnionChestConfig {


    private ActivityInfo activityInfo;

     private int dailyDrawNum;
     private int noticeNum;

    private Map<Integer,UnionChestBoxConfig> boxMap = new ConcurrentHashMap<>();


    public UnionChestConfig(Map<String, ActivityConfig> activityConfigMap) {
        dailyDrawNum = activityConfigMap.get(eActivityConfigType.SOCIATY_PLAYER_DRAW_NUM.getName()).getIntValue();
        noticeNum = activityConfigMap.get(eActivityConfigType.SOCIATY_NOTICE_NUM.getName()).getIntValue();
        String[] split = activityConfigMap.get(eActivityConfigType.SOCIATY_BOX_NUM.getName()).getValue().split("\\|");
        for (String boxStr : split) {
            List<Integer> boxAttrs = StringUtils.stringToIntegerList(boxStr, ",");
            UnionChestBoxConfig boxConfig = new UnionChestBoxConfig();
            boxConfig.setType(boxAttrs.get(0));
            boxConfig.setBoxId(boxAttrs.get(1));
            boxConfig.setNum(boxAttrs.get(2));
            boxMap.put(boxConfig.getType(), boxConfig);
        }
    }


    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public int getDailyDrawNum() {
        return dailyDrawNum;
    }

    public int getNoticeNum() {
        return noticeNum;
    }

    public Map<Integer, UnionChestBoxConfig> getBoxMap() {
        return boxMap;
    }
}
